package com.uni.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.uni.db.GenericService;
import com.uni.domain.User;

@Controller
@RequestMapping("/userDel.htm")
public class UserDel {

    @Autowired
    @Qualifier("userService")
    private GenericService<User> studentService;

    @RequestMapping(method = RequestMethod.GET)
    public String delUser(@RequestParam(value = "id", required = false) Long id) {
        studentService.delete(studentService.get(id));
        return "redirect:/user/list";
    }

}
